<jsp:include page="data?view=food&action=list" />
<jsp:include page="data?view=menu&action=detail" />
<h2>Menu Detail</h2>
<hr />
<form action="service?do=edit&act=menu" method="post">
    <input type="hidden" name="txtId" value="${menu.id}" />
    <table>
        <tbody>
            <tr>
                <td>Name: </td>
                <td><input type="text" name="txtName" value="${menu.name}" ></td>
            </tr>
            <tr>
                <td>Description: </td>
                <td><textarea name="taDescription">${menu.description}</textarea></td>
            </tr>
            <tr>
                <td colspan="2">
                    <input type="submit" value="Update" />
                    &nbsp;
                    <input type="reset" value="Reset" />
                </td>
            </tr>
        </tbody>
    </table>
</form>
<hr />
<h2>List Food</h2>
<c:if test="${empty requestScope.menu.foods}">
    No food found in menu
</c:if>
<c:if test="${not empty requestScope.menu.foods}">
    <table cellpadding="5" cellspacing="5">
        <tbody>
            <tr>
                <th>ID</th>
                <th>Name</th>
                <th>Price</th>
                <th>Description</th>
                <th></th>
            </tr>
        <c:forEach items="${requestScope.menu.foods}" var="food">
            <tr>
                <td><a href="?style=detail&act=food&id=${food.id}">${food.id}</a></td>
                <td>${food.name}</td>
                <td>$${food.price}</td>
                <td>${food.description}</td>
                <td><a href="#" onclick="confirmRemove(${menu.id}, ${food.id})">Remove</a></td>
            </tr>
        </c:forEach>
        </tbody>
    </table>
</c:if>
<h3>Add food to menu</h3>
<c:if test="${empty requestScope.foods}">
    No food found <a href="?do=add&act=food">Add new food</a>
</c:if>
<c:if test="${not empty requestScope.foods}">
    <form action="service?do=update&act=menu" method="post">
        <input type="hidden" name="txtIdMenu" value="${menu.id}" />
        <select name="foodList">
            <c:forEach items="${requestScope.foods}" var="foodUpdate">
                <option value="${foodUpdate.id}">${foodUpdate.name} (Price: $${foodUpdate.price})</option>
            </c:forEach>
        </select>
        <input type="submit" value="Add" />
    </form>
</c:if>